package com.hmall.item.config;

import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * mybatis plus 配置类
 *
 * @Author XiaoJiangShi
 * @Date 2022/8/9 19:51
 * @Blog blog.XiaoJiangShi.net/996.mba
 * @Description:
 */
@Configuration
public class MpConfig {

    /**
     * 添加分页配件
     * @return mp拦截器对象
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor mp = new MybatisPlusInterceptor();
        PaginationInnerInterceptor page = new PaginationInnerInterceptor();
        page.setOverflow(true);
        mp.addInnerInterceptor(page);
        return mp;
    }
}

